package cn.tedu.boot.ers.controller;

import cn.tedu.boot.ers.pojo.dto.OrderProductAddDTO;
import cn.tedu.boot.ers.service.IOrderProductService;
import cn.tedu.boot.ers.web.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/orderProducts")
@Api(tags = "订单-菜品模块,这个客户端不能可视,这是服务端自动写入的")
public class OrderProductController {
    @Autowired
    IOrderProductService service;

    @ApiOperation("点菜,添加菜")
    @PostMapping("addOrderProduct")
    public JsonResult<Void> addOrderProduct(OrderProductAddDTO orderProduct01AddDTO) {
        service.insert(orderProduct01AddDTO);
        return JsonResult.ok();
    }

    @ApiOperation("点菜,删除菜")
    @PostMapping("deleteOrderProduct")
    public JsonResult<Void> deleteOrderProduct(Long id) {
        service.deleteProductById(id);
        return JsonResult.ok();
    }
}
